import request from "/@/utils/request"

export function fetchList(query?: Object) {
  return request({
    url: '/yu/carInfo/page',
    method: 'get',
    params: query
  })
}

export function addObj(obj?: Object) {
  return request({
    url: '/yu/carInfo',
    method: 'post',
    data: obj
  })
}

export function getObj(id?: string) {
  return request({
    url: '/yu/carInfo/' + id,
    method: 'get'
  })
}

export function delObjs(ids?: Object) {
  return request({
    url: '/yu/carInfo',
    method: 'delete',
    data: ids
  })
}

export function putObj(obj?: Object) {
  return request({
    url: '/yu/carInfo',
    method: 'put',
    data: obj
  })
}


/**
 * 获取品牌
 */
export function getBrands(series?: string) {
  return request({
    url: '/yu/carInfo/brands',
    method: 'get',
    params: {
      series: series
    }
  })
}

/**
 * 获取型号
 */
export function getModels(brandId:number) {
  return request({
    url: '/yu/carInfo/models',
    method: 'get',
    params: {
      brandId: brandId
    }
  })
}

/**
 * 获取款式
 */
export function getStyles(modelId: number) {
  return request({
    url: '/yu/carInfo/styles',
    method: 'get',
    params: {
      modelId: modelId
    }
  })
}
// 获取所有标签
export function getAllLabel() {
  return request({
    url: '/yu/carInfo/label',
    method: 'get'
  });
}